package webjoch.process.strategies.puzzles;

import java.awt.Graphics2D;

import com.rsbuddy.event.events.MessageEvent;
import com.rsbuddy.script.methods.Camera;
import com.rsbuddy.script.methods.Players;
import com.rsbuddy.script.util.Random;
import com.rsbuddy.script.wrappers.Npc;

import webjoch.process.strategies.Puzzle;

public class Pondskaters extends Puzzle {
    public final int[] skaters = {12089, 12090, 12091, 12092, 12093};
    public final int goodSkater = 12089;
    @Override
    public boolean isValid() {
        return room.getObject(53983) != null;
    }

    @Override
    public Type getType() {
        return Type.PONDSKATERS;
    }

    @Override
    public int loop() {
        Npc pondskater = room.getNpc(goodSkater);
        if (Players.getLocal().getInteracting() != null) {
            if (Players.getLocal().getInteracting() != pondskater) {
                rotateAndInteract(pondskater, "Catch");
                return 500;
            } else {
                return 50;
            }
        } else {
            rotateAndInteract(pondskater, "Catch");
            return 500;
        }
    }

    @Override
    public int[] itemNeed() {
        return new int[] {17796, 17794};
    }

    @Override
    public boolean isFinished() {
        return false;
    }

    @Override
    public void messageReceived(MessageEvent e) {
        // TODO Auto-generated method stub
        
    }
    
    public void rotateAndInteract(Npc npc, String interact) {
        Camera.turnTo(npc);
        Camera.setPitch(Random.nextInt(25, 50));
        
        npc.interact(interact);
        
        Camera.setPitch(true);
    }

	@Override
	public void onRepaint(Graphics2D g) {
		// TODO Auto-generated method stub
		
	}

}
